home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / develop / libsrc11.arc / STASG.S < prev    next >
Text File  |  1989-04-27  |  1KB  |  61 lines

  1. ******************************************************************************
  2. * stasg.s 3.1 11/12/84 
  3. *
  4. *        68HC11 CROSS C COMPILER RUN-TIME LIBRARY
  5. *
  6. *           (c) Copyright 1984, Motorola, Inc.
  7. *
  8. *  FUNCTION NAME:    .stasg
  9. *
  10. *  ACTION:        Copies structure value
  11. *
  12. *  REGISTERS AND STACK:
  13. *
  14. *  ON ENTRY:    X:    FP (frame pointer)
  15. *        D:    Destination Pointer
  16. *        Y:    Source Pointer
  17. *
  18. *        STACK:      Return Address (Pointer to in-line constant):
  19. *                fdb    struct_size
  20. *        SP:    
  21. *
  22. *  ON EXIT:    X:    FP 
  23. *        D:    Destination Pointer
  24. *
  25. *        STACK:    Previous Contents
  26. *        SP:    
  27. *
  28. ******************************************************************************
  29.     psct
  30.     xdef    .stasg
  31. .stasg:
  32.     pshx        save FP
  33.     pshb        save destination address
  34.     psha
  35.     tsx        make parameter addressable
  36.     ldx    4,%x    return address
  37.     ldd    0,%x    size of structure
  38.     pulx        copy destination address
  39.     pshx        ..into X (leave on stack)
  40.     psha        save upper byte of size
  41.     tstb        if lower byte of size
  42.     beq    uchk    ..is zero check upper byte
  43. move:    ldaa    0,%y    copy byte from source
  44.     staa    0,%x    ..to destination
  45.     iny        increment pointers
  46.     inx
  47.     decb        decrement lower byte count
  48.     bne     move    loop if not zero
  49. uchk:    pula        lower byte zero so...
  50.     tsta        ..check upper byte
  51.     beq    done    done if both are zero
  52.     deca        upper byte count nonzero so...
  53.     psha        ..decrement and...
  54.     bra    move    ..loop again
  55. done:    pula         restore destination address
  56.     pulb
  57.     pulx        restore FP
  58.     puly        return address
  59.     jmp    2,%y    return
  60.     end
  61.